import request from '@/config/axios'

// 题库分类 VO
export interface TestTypeVO {
  id: number // ID
  name: string // 分类名称
  pid: number // 上级分类
  gpid: number // gpid
  price: number // 价格
  isStudent: boolean // 学员专享
}

// 题库分类 API
export const TestTypeApi = {
  // 查询题库分类列表
  getTestTypeList: async (params) => {
    return await request.get({ url: `/exam/test-type/list`, params })
  },

  // 查询题库分类详情
  getTestType: async (id: number) => {
    return await request.get({ url: `/exam/test-type/get?id=` + id })
  },

  // 新增题库分类
  createTestType: async (data: TestTypeVO) => {
    return await request.post({ url: `/exam/test-type/create`, data })
  },

  // 修改题库分类
  updateTestType: async (data: TestTypeVO) => {
    return await request.put({ url: `/exam/test-type/update`, data })
  },

  // 删除题库分类
  deleteTestType: async (id: number) => {
    return await request.delete({ url: `/exam/test-type/delete?id=` + id })
  },

  // 导出题库分类 Excel
  exportTestType: async (params) => {
    return await request.download({ url: `/exam/test-type/export-excel`, params })
  }
}